package COMP;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JPanel;


class DrawLine extends JPanel{
	int xInit;
	int yInit;
	int xEnd;
	int yEnd;
	Color color = Color.black;
	DrawLine(int xInit, int yInit, int xEnd, int yEnd){
		this.xInit = xInit;
		this.yInit = yInit;
		this.xEnd = xEnd;
		this.yEnd = yEnd;
		this.setSize(550,400);
		this.setOpaque(false);
	}
	DrawLine(int xInit, int yInit, int xEnd, int yEnd,Color color){
		this(xInit,yInit,xEnd,yEnd);
		this.color = color;
	}
	public void paint(Graphics g){
		Graphics2D g2d = (Graphics2D)g.create();
		g2d.setStroke(new BasicStroke(1f,BasicStroke.CAP_SQUARE,BasicStroke.JOIN_MITER));
		g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
		g2d.setColor(color);
		g2d.drawLine(xInit, yInit, xEnd, yEnd);
	}
}
